import Vue from 'vue'
import VueRouter from 'vue-router'
import guard from './guard'

function p(name, path) {
    return {
        path: `/${path ? path : name}`,
        name,
        meta: {}
    }
}

Vue.use(VueRouter);

const routes = [
    {
        path: '/',
        redirect: 'home'
    },
    {
        ...p('home'),
        component: () => import('@v/home'),
        meta: {
            title: '家庭网关拨测质量分析统计'
        }
    },
    {
        ...p('probe'),
        component: () => import('@v/probe'),
        meta: {
            title: '全国探针纳管分布'
        }
    },
    {
        ...p('combine'),
        component: () => import('@v/combine'),
        meta: {
            title: '地市质差综合分析'
        }
    },
    {
        ...p('comprehensive'),
        component: () => import('@v/comprehensive'),
        meta: {
            title: '家庭网关业务质量综合分析'
        }
    },
    {
        ...p('benchmarking'),
        component: () => import('@v/benchmarking'),
        meta: {
            title: '宽带行业对标系统分析展示'
        }
    },
    {
      ...p('expressway'),
      component: () => import('@v/expressway'),
      meta: {
        title: ''
      }
    }
];

// guard为路由实例添加全局守卫
export default guard(new VueRouter({
    mode: 'hash',
    routes
}))
